<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>QxOrm: C:/Dvlp/_Perso/QxOrm/include/QxModelView/QxModelService.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="logo_qxorm.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">QxOrm
   &#160;<span id="projectnumber">1.4.3</span>
   </div>
   <div id="projectbrief">C++ Object Relational Mapping library</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_qx_model_service_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">QxModelService.h</div>  </div>
</div>
<div class="contents">
<a href="_qx_model_service_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/****************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">**</span>
<a name="l00003"></a>00003 <span class="comment">** http://www.qxorm.com/</span>
<a name="l00004"></a>00004 <span class="comment">** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)</span>
<a name="l00005"></a>00005 <span class="comment">**</span>
<a name="l00006"></a>00006 <span class="comment">** This file is part of the QxOrm library</span>
<a name="l00007"></a>00007 <span class="comment">**</span>
<a name="l00008"></a>00008 <span class="comment">** This software is provided &#39;as-is&#39;, without any express or implied</span>
<a name="l00009"></a>00009 <span class="comment">** warranty. In no event will the authors be held liable for any</span>
<a name="l00010"></a>00010 <span class="comment">** damages arising from the use of this software</span>
<a name="l00011"></a>00011 <span class="comment">**</span>
<a name="l00012"></a>00012 <span class="comment">** Commercial Usage</span>
<a name="l00013"></a>00013 <span class="comment">** Licensees holding valid commercial QxOrm licenses may use this file in</span>
<a name="l00014"></a>00014 <span class="comment">** accordance with the commercial license agreement provided with the</span>
<a name="l00015"></a>00015 <span class="comment">** Software or, alternatively, in accordance with the terms contained in</span>
<a name="l00016"></a>00016 <span class="comment">** a written agreement between you and Lionel Marty</span>
<a name="l00017"></a>00017 <span class="comment">**</span>
<a name="l00018"></a>00018 <span class="comment">** GNU General Public License Usage</span>
<a name="l00019"></a>00019 <span class="comment">** Alternatively, this file may be used under the terms of the GNU</span>
<a name="l00020"></a>00020 <span class="comment">** General Public License version 3.0 as published by the Free Software</span>
<a name="l00021"></a>00021 <span class="comment">** Foundation and appearing in the file &#39;license.gpl3.txt&#39; included in the</span>
<a name="l00022"></a>00022 <span class="comment">** packaging of this file. Please review the following information to</span>
<a name="l00023"></a>00023 <span class="comment">** ensure the GNU General Public License version 3.0 requirements will be</span>
<a name="l00024"></a>00024 <span class="comment">** met : http://www.gnu.org/copyleft/gpl.html</span>
<a name="l00025"></a>00025 <span class="comment">**</span>
<a name="l00026"></a>00026 <span class="comment">** If you are unsure which license is appropriate for your use, or</span>
<a name="l00027"></a>00027 <span class="comment">** if you have questions regarding the use of this file, please contact :</span>
<a name="l00028"></a>00028 <span class="comment">** contact@qxorm.com</span>
<a name="l00029"></a>00029 <span class="comment">**</span>
<a name="l00030"></a>00030 <span class="comment">****************************************************************************/</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="preprocessor">#ifndef _QX_MODEL_SERVICE_H_</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define _QX_MODEL_SERVICE_H_</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>
<a name="l00035"></a>00035 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;<a class="code" href="_qx_model_8h.html" title="All classes registered into QxOrm context can be used with Qt model/view architecture (Qt widgets and...">QxModelView/QxModel.h</a>&gt;</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="keyword">namespace </span>qx {
<a name="l00049"></a>00049 
<a name="l00057"></a>00057 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T, <span class="keyword">class</span> S&gt;
<a name="l00058"></a><a class="code" href="classqx_1_1_qx_model_service.html">00058</a> <span class="keyword">class </span><a class="code" href="classqx_1_1_qx_model_service.html" title="qx::QxModelService&lt;T, S&gt; : provides an easy way to connect your model to the QxService module (all qu...">QxModelService</a> : <span class="keyword">public</span> qx::<a class="code" href="classqx_1_1_qx_model.html" title="qx::QxModel&lt;T&gt; : all classes registered into QxOrm context can be used with Qt model/view architectur...">QxModel</a>&lt;T&gt;
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 <span class="keyword">public</span>:
<a name="l00062"></a>00062 
<a name="l00063"></a><a class="code" href="classqx_1_1_qx_model_service.html#a8e6a0368bc703bee2560d26f09394307">00063</a>    <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">qx::QxModel&lt;T&gt;::type_ptr</a> <a class="code" href="classqx_1_1_qx_model_service.html#a8e6a0368bc703bee2560d26f09394307">type_ptr</a>;
<a name="l00064"></a><a class="code" href="classqx_1_1_qx_model_service.html#a0d5fd09e07ea3fb6842b8791d0a57a2a">00064</a>    <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classqx_1_1_qx_model.html#a2d1a76e9a19ad15e645dbd6605fa7f3f">qx::QxModel&lt;T&gt;::type_primary_key</a> <a class="code" href="classqx_1_1_qx_model_service.html#a0d5fd09e07ea3fb6842b8791d0a57a2a">type_primary_key</a>;
<a name="l00065"></a><a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">00065</a>    <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classqx_1_1_qx_collection.html">qx::QxModel&lt;T&gt;::type_collection</a> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>;
<a name="l00066"></a><a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">00066</a>    <span class="keyword">typedef</span> qx_shared_ptr&lt;type_collection&gt; <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a>;
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="keyword">public</span>:
<a name="l00069"></a>00069 
<a name="l00070"></a><a class="code" href="classqx_1_1_qx_model_service.html#a1688aa8534663d3421929ad4ba6d97a6">00070</a>    <a class="code" href="classqx_1_1_qx_model_service.html#a1688aa8534663d3421929ad4ba6d97a6">QxModelService</a>(QObject * <a class="code" href="classqx_1_1_ix_model.html#a5b6062f358ef8ffa0c9d11f2b677ca14">parent</a> = 0) : qx::<a class="code" href="classqx_1_1_qx_model.html" title="qx::QxModel&lt;T&gt; : all classes registered into QxOrm context can be used with Qt model/view architectur...">QxModel</a>&lt;T&gt;(<a class="code" href="classqx_1_1_ix_model.html#a5b6062f358ef8ffa0c9d11f2b677ca14">parent</a>) { ; }
<a name="l00071"></a><a class="code" href="classqx_1_1_qx_model_service.html#aaa786fe09c16abb2b8afe9a6ff1724ab">00071</a>    <a class="code" href="classqx_1_1_qx_model_service.html#aaa786fe09c16abb2b8afe9a6ff1724ab">QxModelService</a>(<a class="code" href="classqx_1_1_ix_model.html" title="qx::IxModel : interface to manage Qt model/view architecture with classes registered into QxOrm conte...">qx::IxModel</a> * other, QObject * <a class="code" href="classqx_1_1_ix_model.html#a5b6062f358ef8ffa0c9d11f2b677ca14">parent</a>) : qx::<a class="code" href="classqx_1_1_qx_model.html" title="qx::QxModel&lt;T&gt; : all classes registered into QxOrm context can be used with Qt model/view architectur...">QxModel</a>&lt;T&gt;(other, parent) { ; }
<a name="l00072"></a><a class="code" href="classqx_1_1_qx_model_service.html#a29bad6d326434428ad4c9178b621e284">00072</a>    <span class="keyword">virtual</span> <a class="code" href="classqx_1_1_qx_model_service.html#a29bad6d326434428ad4c9178b621e284">~QxModelService</a>() { ; }
<a name="l00073"></a>00073 
<a name="l00074"></a><a class="code" href="classqx_1_1_qx_model_service.html#ae46142dd9ed9c6823af1a0e2461b68f5">00074</a>    <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classqx_1_1_qx_model_service.html#ae46142dd9ed9c6823af1a0e2461b68f5" title="Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm c...">qxCount</a>(<span class="keyword">const</span> <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query = <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a>(), QSqlDatabase * pDatabase = NULL)
<a name="l00075"></a>00075    {
<a name="l00076"></a>00076       <span class="keywordtype">long</span> lCount = 0;
<a name="l00077"></a>00077       this-&gt;<a class="code" href="classqx_1_1_qx_model_service.html#ae46142dd9ed9c6823af1a0e2461b68f5" title="Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm c...">qxCount</a>(lCount, query, pDatabase);
<a name="l00078"></a>00078       <span class="keywordflow">return</span> lCount;
<a name="l00079"></a>00079    }
<a name="l00080"></a>00080 
<a name="l00081"></a><a class="code" href="classqx_1_1_qx_model_service.html#ac86f8537fd4c156bd3c8af5e61e8405d">00081</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#ae46142dd9ed9c6823af1a0e2461b68f5" title="Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm c...">qxCount</a>(<span class="keywordtype">long</span> &amp; lCount, <span class="keyword">const</span> <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query = <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a>(), QSqlDatabase * pDatabase = NULL)
<a name="l00082"></a>00082    {
<a name="l00083"></a>00083       Q_UNUSED(pDatabase);
<a name="l00084"></a>00084       S services;
<a name="l00085"></a>00085       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.count(lCount, query);
<a name="l00086"></a>00086       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00087"></a>00087    }
<a name="l00088"></a>00088 
<a name="l00089"></a><a class="code" href="classqx_1_1_qx_model_service.html#a4da259fab037cc8286d14f05c349ce34">00089</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a4da259fab037cc8286d14f05c349ce34" title="Clear the model and fetch an object (retrieve all its properties) of type T (registered into QxOrm co...">qxFetchById</a>(<span class="keyword">const</span> QVariant &amp; <span class="keywordtype">id</span>, <span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00090"></a>00090    {
<a name="l00091"></a>00091       Q_UNUSED(pDatabase);
<a name="l00092"></a>00092       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a9dcc6de207be096a869911b4b4739414">clear</a>();
<a name="l00093"></a>00093       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = <a class="code" href="classqx_1_1_qx_model_service.html#a8e6a0368bc703bee2560d26f09394307">type_ptr</a>(<span class="keyword">new</span> T());
<a name="l00094"></a>00094       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { qDebug(<span class="stringliteral">&quot;[QxOrm] problem with &#39;qxFetchById()&#39; method : &#39;%s&#39;&quot;</span>, <span class="stringliteral">&quot;data member id not registered&quot;</span>); <a class="code" href="_qx_macro_8h.html#a70ab6c4ed8eb3e23107f171e0b41d612">qAssert</a>(<span class="keyword">false</span>); }
<a name="l00095"></a>00095       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = QSqlError(<span class="stringliteral">&quot;[QxOrm] problem with &#39;qxFetchById()&#39; method : &#39;data member id not registered&#39;&quot;</span>, <span class="stringliteral">&quot;&quot;</span>, QSqlError::UnknownError); <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>; }
<a name="l00096"></a>00096       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#ab745b2a043797eecfe769c3f51257a35">fromVariant</a>(pItem.get(), id);
<a name="l00097"></a>00097 
<a name="l00098"></a>00098       <a class="code" href="classqx_1_1_qx_model.html#a2d1a76e9a19ad15e645dbd6605fa7f3f">type_primary_key</a> primaryKey;
<a name="l00099"></a>00099       <a class="code" href="namespaceqx_1_1cvt.html#a38fbb18bd04613956f3900604f5746be">qx::cvt::from_variant</a>(<span class="keywordtype">id</span>, primaryKey);
<a name="l00100"></a>00100       this-&gt;beginInsertRows(QModelIndex(), 0, 0);
<a name="l00101"></a>00101       this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#a0f4fa1d6008d5910103be9037f20665b" title="Add element &#39;value&#39; at the end of the list indexed by &#39;key&#39;.">insert</a>(primaryKey, pItem);
<a name="l00102"></a>00102 
<a name="l00103"></a>00103       S services;
<a name="l00104"></a>00104       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.fetchById(pItem, this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aa232e4e69f86a81b984b8572699fb5e3" title="List of columns exposed by the model (if empty, all columns)">m_lstColumns</a>, relation);
<a name="l00105"></a>00105       this-&gt;endInsertRows();
<a name="l00106"></a>00106       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00107"></a>00107    }
<a name="l00108"></a>00108 
<a name="l00109"></a><a class="code" href="classqx_1_1_qx_model_service.html#a5c5bb6677c6f194c7a2ae3f2a453cdb1">00109</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a5c5bb6677c6f194c7a2ae3f2a453cdb1" title="Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type...">qxFetchAll</a>(<span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00110"></a>00110    {
<a name="l00111"></a>00111       Q_UNUSED(pDatabase);
<a name="l00112"></a>00112       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a9dcc6de207be096a869911b4b4739414">clear</a>();
<a name="l00113"></a>00113 
<a name="l00114"></a>00114       S services;
<a name="l00115"></a>00115       <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a> tmp;
<a name="l00116"></a>00116       tmp.reset(<span class="keyword">new</span> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>());
<a name="l00117"></a>00117       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.fetchAll(tmp, this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aa232e4e69f86a81b984b8572699fb5e3" title="List of columns exposed by the model (if empty, all columns)">m_lstColumns</a>, relation);
<a name="l00118"></a>00118 
<a name="l00119"></a>00119       <span class="keywordflow">if</span> (tmp-&gt;count() &lt;= 0) { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>; }
<a name="l00120"></a>00120       this-&gt;beginInsertRows(QModelIndex(), 0, (tmp-&gt;count() - 1));
<a name="l00121"></a>00121       this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a> = (* tmp);
<a name="l00122"></a>00122       this-&gt;endInsertRows();
<a name="l00123"></a>00123       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00124"></a>00124    }
<a name="l00125"></a>00125 
<a name="l00126"></a><a class="code" href="classqx_1_1_qx_model_service.html#ae1e8e0770048a3d9a1c65224525907c8">00126</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#ae1e8e0770048a3d9a1c65224525907c8" title="Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type...">qxFetchByQuery</a>(<span class="keyword">const</span> <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query, <span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00127"></a>00127    {
<a name="l00128"></a>00128       Q_UNUSED(pDatabase);
<a name="l00129"></a>00129       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a9dcc6de207be096a869911b4b4739414">clear</a>();
<a name="l00130"></a>00130 
<a name="l00131"></a>00131       S services;
<a name="l00132"></a>00132       <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a> tmp;
<a name="l00133"></a>00133       tmp.reset(<span class="keyword">new</span> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>());
<a name="l00134"></a>00134       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.fetchByQuery(query, tmp, this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aa232e4e69f86a81b984b8572699fb5e3" title="List of columns exposed by the model (if empty, all columns)">m_lstColumns</a>, relation);
<a name="l00135"></a>00135 
<a name="l00136"></a>00136       <span class="keywordflow">if</span> (tmp-&gt;count() &lt;= 0) { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>; }
<a name="l00137"></a>00137       this-&gt;beginInsertRows(QModelIndex(), 0, (tmp-&gt;count() - 1));
<a name="l00138"></a>00138       this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a> = (* tmp);
<a name="l00139"></a>00139       this-&gt;endInsertRows();
<a name="l00140"></a>00140       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00141"></a>00141    }
<a name="l00142"></a>00142 
<a name="l00143"></a><a class="code" href="classqx_1_1_qx_model_service.html#ae5ed4a8ed5892f150f4bd3f2a2647be8">00143</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#ae5ed4a8ed5892f150f4bd3f2a2647be8" title="Get an item in the model at line row and fetch all its properties mapped to a table in the database...">qxFetchRow</a>(<span class="keywordtype">int</span> row, <span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00144"></a>00144    {
<a name="l00145"></a>00145       Q_UNUSED(pDatabase);
<a name="l00146"></a>00146       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00147"></a>00147       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00148"></a>00148 
<a name="l00149"></a>00149       S services;
<a name="l00150"></a>00150       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.fetchById(pItem, this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aa232e4e69f86a81b984b8572699fb5e3" title="List of columns exposed by the model (if empty, all columns)">m_lstColumns</a>, relation);
<a name="l00151"></a>00151       <span class="keywordflow">if</span> (this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>.isValid()) { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>; }
<a name="l00152"></a>00152 
<a name="l00153"></a>00153       QModelIndex idxTopLeft = this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a4b4dc018bbb117a834715e6ba8a19b0f">index</a>(row, 0);
<a name="l00154"></a>00154       QModelIndex idxBottomRight = this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a4b4dc018bbb117a834715e6ba8a19b0f">index</a>(row, (this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a3f22f2b0fc0ad816433af8026db9d048" title="List of data member exposed by the model.">m_lstDataMember</a>.count() - 1));
<a name="l00155"></a>00155       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a8627052e760774c91d519bffcbf14ee0">raiseEvent_dataChanged</a>(idxTopLeft, idxBottomRight);
<a name="l00156"></a>00156       this-&gt;<a class="code" href="classqx_1_1_qx_model.html#aa98a3e1c421a049b707d9c36b9f2df84">updateKey</a>(row);
<a name="l00157"></a>00157       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00158"></a>00158    }
<a name="l00159"></a>00159 
<a name="l00160"></a><a class="code" href="classqx_1_1_qx_model_service.html#a977df8c09bc3e41acb9f9b7aad93ad25">00160</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a977df8c09bc3e41acb9f9b7aad93ad25" title="Insert all items in the model into database.">qxInsert</a>(<span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00161"></a>00161    {
<a name="l00162"></a>00162       Q_UNUSED(pDatabase);
<a name="l00163"></a>00163       <span class="keywordflow">if</span> (relation.count() &gt; 0) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a8b2b46f3acd67d2ea4267257fd70f380">syncAllNestedModel</a>(relation); }
<a name="l00164"></a>00164 
<a name="l00165"></a>00165       <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a> tmp;
<a name="l00166"></a>00166       tmp.reset(<span class="keyword">new</span> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>());
<a name="l00167"></a>00167       (* tmp) = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>;
<a name="l00168"></a>00168 
<a name="l00169"></a>00169       S services;
<a name="l00170"></a>00170       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.insert(tmp, relation);
<a name="l00171"></a>00171 
<a name="l00172"></a>00172       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>.isValid()) { this-&gt;<a class="code" href="classqx_1_1_qx_model.html#a9d18f4b9e70c6f79a83c51b14786f011">updateAllKeys</a>(); }
<a name="l00173"></a>00173       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00174"></a>00174    }
<a name="l00175"></a>00175 
<a name="l00176"></a><a class="code" href="classqx_1_1_qx_model_service.html#a7141746bcb32da616d9a1bf70930c72b">00176</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a7141746bcb32da616d9a1bf70930c72b" title="Insert an item of the model at line row into database.">qxInsertRow</a>(<span class="keywordtype">int</span> row, <span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00177"></a>00177    {
<a name="l00178"></a>00178       Q_UNUSED(pDatabase);
<a name="l00179"></a>00179       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00180"></a>00180       <span class="keywordflow">if</span> (relation.count() &gt; 0) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aeb4e45ddd7008a92b7b96190d646667d">syncNestedModel</a>(row, relation); }
<a name="l00181"></a>00181       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00182"></a>00182 
<a name="l00183"></a>00183       S services;
<a name="l00184"></a>00184       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.insert(pItem, relation);
<a name="l00185"></a>00185 
<a name="l00186"></a>00186       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>.isValid()) { this-&gt;<a class="code" href="classqx_1_1_qx_model.html#aa98a3e1c421a049b707d9c36b9f2df84">updateKey</a>(row); }
<a name="l00187"></a>00187       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00188"></a>00188    }
<a name="l00189"></a>00189 
<a name="l00190"></a><a class="code" href="classqx_1_1_qx_model_service.html#a3f2536e90532a95b95f3e4184d75fbbb">00190</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a3f2536e90532a95b95f3e4184d75fbbb" title="Update all items in the model into database.">qxUpdate</a>(<span class="keyword">const</span> <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query = <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a>(), <span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00191"></a>00191    {
<a name="l00192"></a>00192       Q_UNUSED(pDatabase);
<a name="l00193"></a>00193       <span class="keywordflow">if</span> (relation.count() &gt; 0) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a8b2b46f3acd67d2ea4267257fd70f380">syncAllNestedModel</a>(relation); }
<a name="l00194"></a>00194 
<a name="l00195"></a>00195       <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a> tmp;
<a name="l00196"></a>00196       tmp.reset(<span class="keyword">new</span> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>());
<a name="l00197"></a>00197       (* tmp) = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>;
<a name="l00198"></a>00198 
<a name="l00199"></a>00199       S services;
<a name="l00200"></a>00200       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.update(tmp, query, this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aa232e4e69f86a81b984b8572699fb5e3" title="List of columns exposed by the model (if empty, all columns)">m_lstColumns</a>, relation);
<a name="l00201"></a>00201 
<a name="l00202"></a>00202       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>.isValid()) { this-&gt;<a class="code" href="classqx_1_1_qx_model.html#a9d18f4b9e70c6f79a83c51b14786f011">updateAllKeys</a>(); }
<a name="l00203"></a>00203       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00204"></a>00204    }
<a name="l00205"></a>00205 
<a name="l00206"></a><a class="code" href="classqx_1_1_qx_model_service.html#a6223f182711b842d1f27796931e3b3c5">00206</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a6223f182711b842d1f27796931e3b3c5" title="Update an item of the model at line row into database.">qxUpdateRow</a>(<span class="keywordtype">int</span> row, <span class="keyword">const</span> <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query = <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a>(), <span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00207"></a>00207    {
<a name="l00208"></a>00208       Q_UNUSED(pDatabase);
<a name="l00209"></a>00209       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00210"></a>00210       <span class="keywordflow">if</span> (relation.count() &gt; 0) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aeb4e45ddd7008a92b7b96190d646667d">syncNestedModel</a>(row, relation); }
<a name="l00211"></a>00211       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00212"></a>00212 
<a name="l00213"></a>00213       S services;
<a name="l00214"></a>00214       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.update(pItem, query, this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aa232e4e69f86a81b984b8572699fb5e3" title="List of columns exposed by the model (if empty, all columns)">m_lstColumns</a>, relation);
<a name="l00215"></a>00215 
<a name="l00216"></a>00216       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>.isValid()) { this-&gt;<a class="code" href="classqx_1_1_qx_model.html#aa98a3e1c421a049b707d9c36b9f2df84">updateKey</a>(row); }
<a name="l00217"></a>00217       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00218"></a>00218    }
<a name="l00219"></a>00219 
<a name="l00220"></a><a class="code" href="classqx_1_1_qx_model_service.html#a59ef8ce2d68d0c1daceac25775bf7e58">00220</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a59ef8ce2d68d0c1daceac25775bf7e58" title="Save all items (insert or update) in the model into database.">qxSave</a>(<span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00221"></a>00221    {
<a name="l00222"></a>00222       Q_UNUSED(pDatabase);
<a name="l00223"></a>00223       <span class="keywordflow">if</span> (relation.count() &gt; 0) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a8b2b46f3acd67d2ea4267257fd70f380">syncAllNestedModel</a>(relation); }
<a name="l00224"></a>00224 
<a name="l00225"></a>00225       <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a> tmp;
<a name="l00226"></a>00226       tmp.reset(<span class="keyword">new</span> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>());
<a name="l00227"></a>00227       (* tmp) = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>;
<a name="l00228"></a>00228 
<a name="l00229"></a>00229       S services;
<a name="l00230"></a>00230       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.save(tmp, relation);
<a name="l00231"></a>00231 
<a name="l00232"></a>00232       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>.isValid()) { this-&gt;<a class="code" href="classqx_1_1_qx_model.html#a9d18f4b9e70c6f79a83c51b14786f011">updateAllKeys</a>(); }
<a name="l00233"></a>00233       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00234"></a>00234    }
<a name="l00235"></a>00235 
<a name="l00236"></a><a class="code" href="classqx_1_1_qx_model_service.html#ae3f074858ae605e76d09d0b363aaaa83">00236</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#ae3f074858ae605e76d09d0b363aaaa83" title="Save an item of the model at line row into database.">qxSaveRow</a>(<span class="keywordtype">int</span> row, <span class="keyword">const</span> QStringList &amp; relation = QStringList(), QSqlDatabase * pDatabase = NULL)
<a name="l00237"></a>00237    {
<a name="l00238"></a>00238       Q_UNUSED(pDatabase);
<a name="l00239"></a>00239       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00240"></a>00240       <span class="keywordflow">if</span> (relation.count() &gt; 0) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#aeb4e45ddd7008a92b7b96190d646667d">syncNestedModel</a>(row, relation); }
<a name="l00241"></a>00241       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00242"></a>00242 
<a name="l00243"></a>00243       S services;
<a name="l00244"></a>00244       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.save(pItem, relation);
<a name="l00245"></a>00245 
<a name="l00246"></a>00246       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>.isValid()) { this-&gt;<a class="code" href="classqx_1_1_qx_model.html#aa98a3e1c421a049b707d9c36b9f2df84">updateKey</a>(row); }
<a name="l00247"></a>00247       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00248"></a>00248    }
<a name="l00249"></a>00249 
<a name="l00250"></a><a class="code" href="classqx_1_1_qx_model_service.html#a0694dc6874ef422e64f8545953f318af">00250</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a0694dc6874ef422e64f8545953f318af" title="Delete a line of a table (database) mapped to a C++ object of type T (registered into QxOrm context)...">qxDeleteById</a>(<span class="keyword">const</span> QVariant &amp; <span class="keywordtype">id</span>, QSqlDatabase * pDatabase = NULL)
<a name="l00251"></a>00251    {
<a name="l00252"></a>00252       Q_UNUSED(pDatabase);
<a name="l00253"></a>00253       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = <a class="code" href="classqx_1_1_qx_model_service.html#a8e6a0368bc703bee2560d26f09394307">type_ptr</a>(<span class="keyword">new</span> T());
<a name="l00254"></a>00254       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { qDebug(<span class="stringliteral">&quot;[QxOrm] problem with &#39;qxDeleteById()&#39; method : &#39;%s&#39;&quot;</span>, <span class="stringliteral">&quot;data member id not registered&quot;</span>); <a class="code" href="_qx_macro_8h.html#a70ab6c4ed8eb3e23107f171e0b41d612">qAssert</a>(<span class="keyword">false</span>); }
<a name="l00255"></a>00255       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = QSqlError(<span class="stringliteral">&quot;[QxOrm] problem with &#39;qxDeleteById()&#39; method : &#39;data member id not registered&#39;&quot;</span>, <span class="stringliteral">&quot;&quot;</span>, QSqlError::UnknownError); <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>; }
<a name="l00256"></a>00256       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#ab745b2a043797eecfe769c3f51257a35">fromVariant</a>(pItem.get(), id);
<a name="l00257"></a>00257 
<a name="l00258"></a>00258       S services;
<a name="l00259"></a>00259       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.deleteById(pItem);
<a name="l00260"></a>00260       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00261"></a>00261    }
<a name="l00262"></a>00262 
<a name="l00263"></a><a class="code" href="classqx_1_1_qx_model_service.html#ac8e4ad35f6724cbeb390f51328ca2847">00263</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#ac8e4ad35f6724cbeb390f51328ca2847" title="Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context)...">qxDeleteAll</a>(QSqlDatabase * pDatabase = NULL)
<a name="l00264"></a>00264    {
<a name="l00265"></a>00265       Q_UNUSED(pDatabase);
<a name="l00266"></a>00266       S services;
<a name="l00267"></a>00267       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.deleteAll();
<a name="l00268"></a>00268       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00269"></a>00269    }
<a name="l00270"></a>00270 
<a name="l00271"></a><a class="code" href="classqx_1_1_qx_model_service.html#a56c614063256f28d9c5ec1154e3923d3">00271</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a56c614063256f28d9c5ec1154e3923d3" title="Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and fi...">qxDeleteByQuery</a>(<span class="keyword">const</span> <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query, QSqlDatabase * pDatabase = NULL)
<a name="l00272"></a>00272    {
<a name="l00273"></a>00273       Q_UNUSED(pDatabase);
<a name="l00274"></a>00274       S services;
<a name="l00275"></a>00275       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.deleteByQuery(query);
<a name="l00276"></a>00276       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00277"></a>00277    }
<a name="l00278"></a>00278 
<a name="l00279"></a><a class="code" href="classqx_1_1_qx_model_service.html#ad716687570e642cc8945209cbca5f654">00279</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#ad716687570e642cc8945209cbca5f654" title="Delete in database the item at line row in the model, if no error occurred then you should remove row...">qxDeleteRow</a>(<span class="keywordtype">int</span> row, QSqlDatabase * pDatabase = NULL)
<a name="l00280"></a>00280    {
<a name="l00281"></a>00281       Q_UNUSED(pDatabase);
<a name="l00282"></a>00282       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00283"></a>00283       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00284"></a>00284 
<a name="l00285"></a>00285       S services;
<a name="l00286"></a>00286       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.deleteById(pItem);
<a name="l00287"></a>00287       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00288"></a>00288    }
<a name="l00289"></a>00289 
<a name="l00290"></a><a class="code" href="classqx_1_1_qx_model_service.html#a667c3df48ce891808338d982a013bf91">00290</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a667c3df48ce891808338d982a013bf91" title="Delete a line of a table (even if a logical delete is defined) mapped to a C++ object of type T (regi...">qxDestroyById</a>(<span class="keyword">const</span> QVariant &amp; <span class="keywordtype">id</span>, QSqlDatabase * pDatabase = NULL)
<a name="l00291"></a>00291    {
<a name="l00292"></a>00292       Q_UNUSED(pDatabase);
<a name="l00293"></a>00293       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = <a class="code" href="classqx_1_1_qx_model_service.html#a8e6a0368bc703bee2560d26f09394307">type_ptr</a>(<span class="keyword">new</span> T());
<a name="l00294"></a>00294       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { qDebug(<span class="stringliteral">&quot;[QxOrm] problem with &#39;qxDeleteById()&#39; method : &#39;%s&#39;&quot;</span>, <span class="stringliteral">&quot;data member id not registered&quot;</span>); <a class="code" href="_qx_macro_8h.html#a70ab6c4ed8eb3e23107f171e0b41d612">qAssert</a>(<span class="keyword">false</span>); }
<a name="l00295"></a>00295       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = QSqlError(<span class="stringliteral">&quot;[QxOrm] problem with &#39;qxDeleteById()&#39; method : &#39;data member id not registered&#39;&quot;</span>, <span class="stringliteral">&quot;&quot;</span>, QSqlError::UnknownError); <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>; }
<a name="l00296"></a>00296       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#ab745b2a043797eecfe769c3f51257a35">fromVariant</a>(pItem.get(), id);
<a name="l00297"></a>00297 
<a name="l00298"></a>00298       S services;
<a name="l00299"></a>00299       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.destroyById(pItem);
<a name="l00300"></a>00300       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00301"></a>00301    }
<a name="l00302"></a>00302 
<a name="l00303"></a><a class="code" href="classqx_1_1_qx_model_service.html#a6318e827bad56e4f0a3a63102452ce68">00303</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a6318e827bad56e4f0a3a63102452ce68" title="Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered...">qxDestroyAll</a>(QSqlDatabase * pDatabase = NULL)
<a name="l00304"></a>00304    {
<a name="l00305"></a>00305       Q_UNUSED(pDatabase);
<a name="l00306"></a>00306       S services;
<a name="l00307"></a>00307       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.destroyAll();
<a name="l00308"></a>00308       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00309"></a>00309    }
<a name="l00310"></a>00310 
<a name="l00311"></a><a class="code" href="classqx_1_1_qx_model_service.html#a5181ca7717672d35d93021286e142e12">00311</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a5181ca7717672d35d93021286e142e12" title="Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered...">qxDestroyByQuery</a>(<span class="keyword">const</span> <a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query, QSqlDatabase * pDatabase = NULL)
<a name="l00312"></a>00312    {
<a name="l00313"></a>00313       Q_UNUSED(pDatabase);
<a name="l00314"></a>00314       S services;
<a name="l00315"></a>00315       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.destroyByQuery(query);
<a name="l00316"></a>00316       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00317"></a>00317    }
<a name="l00318"></a>00318 
<a name="l00319"></a><a class="code" href="classqx_1_1_qx_model_service.html#a3b0c73818a2354f2f61e8795f2d4f3cf">00319</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#a3b0c73818a2354f2f61e8795f2d4f3cf" title="Delete in database (even if a logical delete is defined) the item at line row in the model...">qxDestroyRow</a>(<span class="keywordtype">int</span> row, QSqlDatabase * pDatabase = NULL)
<a name="l00320"></a>00320    {
<a name="l00321"></a>00321       Q_UNUSED(pDatabase);
<a name="l00322"></a>00322       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00323"></a>00323       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> QSqlError(); }
<a name="l00324"></a>00324 
<a name="l00325"></a>00325       S services;
<a name="l00326"></a>00326       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.destroyById(pItem);
<a name="l00327"></a>00327       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00328"></a>00328    }
<a name="l00329"></a>00329 
<a name="l00330"></a><a class="code" href="classqx_1_1_qx_model_service.html#ace0e30235c884481010a1a967959aae5">00330</a>    <span class="keyword">virtual</span> QSqlError <a class="code" href="classqx_1_1_qx_model_service.html#ace0e30235c884481010a1a967959aae5">qxExecuteQuery</a>(<a class="code" href="classqx_1_1_qx_sql_query.html" title="qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library...">qx::QxSqlQuery</a> &amp; query, QSqlDatabase * pDatabase = NULL)
<a name="l00331"></a>00331    {
<a name="l00332"></a>00332       Q_UNUSED(pDatabase);
<a name="l00333"></a>00333       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a9dcc6de207be096a869911b4b4739414">clear</a>();
<a name="l00334"></a>00334 
<a name="l00335"></a>00335       S services;
<a name="l00336"></a>00336       <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a> tmp;
<a name="l00337"></a>00337       tmp.reset(<span class="keyword">new</span> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>());
<a name="l00338"></a>00338       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a> = services.executeQuery(query, tmp);
<a name="l00339"></a>00339 
<a name="l00340"></a>00340       <span class="keywordflow">if</span> (tmp-&gt;count() &lt;= 0) { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>; }
<a name="l00341"></a>00341       this-&gt;beginInsertRows(QModelIndex(), 0, (tmp-&gt;count() - 1));
<a name="l00342"></a>00342       this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a> = (* tmp);
<a name="l00343"></a>00343       this-&gt;endInsertRows();
<a name="l00344"></a>00344       <span class="keywordflow">return</span> this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a5783fb8b325f7e84df2b1f19346c4cd8" title="Last SQL error.">m_lastError</a>;
<a name="l00345"></a>00345    }
<a name="l00346"></a>00346 
<a name="l00347"></a><a class="code" href="classqx_1_1_qx_model_service.html#ab6684e19a712b3426aa82742097785c7">00347</a>    <span class="keyword">virtual</span> <a class="code" href="classqx_1_1_qx_bool.html" title="qx_bool : boolean type with code and description message when an error occured">qx_bool</a> <a class="code" href="classqx_1_1_qx_model_service.html#ab6684e19a712b3426aa82742097785c7">qxExist</a>(<span class="keyword">const</span> QVariant &amp; <span class="keywordtype">id</span>, QSqlDatabase * pDatabase = NULL)
<a name="l00348"></a>00348    {
<a name="l00349"></a>00349       Q_UNUSED(pDatabase);
<a name="l00350"></a>00350       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = <a class="code" href="classqx_1_1_qx_model_service.html#a8e6a0368bc703bee2560d26f09394307">type_ptr</a>(<span class="keyword">new</span> T());
<a name="l00351"></a>00351       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { qDebug(<span class="stringliteral">&quot;[QxOrm] problem with &#39;qxExist()&#39; method : &#39;%s&#39;&quot;</span>, <span class="stringliteral">&quot;data member id not registered&quot;</span>); <a class="code" href="_qx_macro_8h.html#a70ab6c4ed8eb3e23107f171e0b41d612">qAssert</a>(<span class="keyword">false</span>); }
<a name="l00352"></a>00352       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>) { <span class="keywordflow">return</span> <a class="code" href="_qx_bool_8h.html#a40069a4245b458585997dadea3a86b33">qx_bool</a>(<span class="keyword">false</span>); }
<a name="l00353"></a>00353       this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#ab745b2a043797eecfe769c3f51257a35">fromVariant</a>(pItem.get(), id);
<a name="l00354"></a>00354 
<a name="l00355"></a>00355       S services;
<a name="l00356"></a>00356       <span class="keywordflow">return</span> services.exist(pItem);
<a name="l00357"></a>00357    }
<a name="l00358"></a>00358 
<a name="l00359"></a><a class="code" href="classqx_1_1_qx_model_service.html#afe3fcf1f096a4ca66b3e1dc4c6417691">00359</a>    <span class="keyword">virtual</span> <a class="code" href="classqx_1_1_qx_invalid_value_x.html" title="qx::QxInvalidValueX : list of invalid values">qx::QxInvalidValueX</a> <a class="code" href="classqx_1_1_qx_model_service.html#afe3fcf1f096a4ca66b3e1dc4c6417691">qxValidate</a>(<span class="keyword">const</span> QStringList &amp; groups = QStringList())
<a name="l00360"></a>00360    {
<a name="l00361"></a>00361       Q_UNUSED(groups);
<a name="l00362"></a>00362       S services;
<a name="l00363"></a>00363       <a class="code" href="classqx_1_1_qx_model_service.html#a7ba010bbbc7b618d435ebcc0c1311d64">type_collection_ptr</a> tmp;
<a name="l00364"></a>00364       tmp.reset(<span class="keyword">new</span> <a class="code" href="classqx_1_1_qx_model_service.html#a6d75075388005f70fc8a7a91688f5f66">type_collection</a>());
<a name="l00365"></a>00365       (* tmp) = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>;
<a name="l00366"></a>00366       <span class="keywordflow">return</span> services.isValid(tmp);
<a name="l00367"></a>00367    }
<a name="l00368"></a>00368 
<a name="l00369"></a><a class="code" href="classqx_1_1_qx_model_service.html#afaeda251b47b90fa15f65009de330639">00369</a>    <span class="keyword">virtual</span> <a class="code" href="classqx_1_1_qx_invalid_value_x.html" title="qx::QxInvalidValueX : list of invalid values">qx::QxInvalidValueX</a> <a class="code" href="classqx_1_1_qx_model_service.html#afaeda251b47b90fa15f65009de330639">qxValidateRow</a>(<span class="keywordtype">int</span> row, <span class="keyword">const</span> QStringList &amp; groups = QStringList())
<a name="l00370"></a>00370    {
<a name="l00371"></a>00371       Q_UNUSED(groups);
<a name="l00372"></a>00372       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> <a class="code" href="classqx_1_1_qx_invalid_value_x.html" title="qx::QxInvalidValueX : list of invalid values">qx::QxInvalidValueX</a>(); }
<a name="l00373"></a>00373       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> <a class="code" href="classqx_1_1_qx_invalid_value_x.html" title="qx::QxInvalidValueX : list of invalid values">qx::QxInvalidValueX</a>(); }
<a name="l00374"></a>00374 
<a name="l00375"></a>00375       S services;
<a name="l00376"></a>00376       <span class="keywordflow">return</span> services.isValid(pItem);
<a name="l00377"></a>00377    }
<a name="l00378"></a>00378 
<a name="l00379"></a>00379 <span class="keyword">protected</span>:
<a name="l00380"></a>00380 
<a name="l00381"></a>00381 <span class="preprocessor">#ifndef _QX_NO_JSON</span>
<a name="l00382"></a>00382 <span class="preprocessor"></span>
<a name="l00383"></a><a class="code" href="classqx_1_1_qx_model_service.html#ae917e68b8da8d5ad7901dcea932e8759">00383</a>    <span class="keyword">virtual</span> QVariant <a class="code" href="classqx_1_1_qx_model_service.html#ae917e68b8da8d5ad7901dcea932e8759">getRelationshipValues_Helper</a>(<span class="keywordtype">int</span> row, <span class="keyword">const</span> QString &amp; relation, <span class="keywordtype">bool</span> bLoadFromDatabase, <span class="keyword">const</span> QString &amp; sAppendRelations)
<a name="l00384"></a>00384    {
<a name="l00385"></a>00385       <span class="keywordflow">if</span> ((row &lt; 0) || (row &gt;= this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab8f0528865494102febab56031988a9a" title="Return the number of items in the list (same as &#39;size()&#39;)">count</a>())) { <span class="keywordflow">return</span> QVariant(); }
<a name="l00386"></a>00386       <span class="keywordflow">if</span> (! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a> || ! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a6c5d8059723c2f7ff3ef15f431f03d0b" title="List of properties defined into QxOrm context.">m_pDataMemberX</a> || ! this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a6c5d8059723c2f7ff3ef15f431f03d0b" title="List of properties defined into QxOrm context.">m_pDataMemberX</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member_x.html#a8b897ee35ed11dc58762e36b2fcbaf7c">exist</a>(relation)) { <span class="keywordflow">return</span> QVariant(); }
<a name="l00387"></a>00387       <a class="code" href="classqx_1_1_ix_data_member.html" title="qx::IxDataMember : common interface for all class properties registered into QxOrm context...">IxDataMember</a> * pDataMember = this-&gt;<a class="code" href="classqx_1_1_ix_model.html#a6c5d8059723c2f7ff3ef15f431f03d0b" title="List of properties defined into QxOrm context.">m_pDataMemberX</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member_x.html#a85c9ce031745f0ec8ffa9ec786d9185d">get_WithDaoStrategy</a>(relation); <span class="keywordflow">if</span> (! pDataMember) { <span class="keywordflow">return</span> QVariant(); }
<a name="l00388"></a>00388       <a class="code" href="classqx_1_1_ix_sql_relation.html" title="qx::IxSqlRelation : common interface for all relationships defined between 2 classes (or between 2 ta...">IxSqlRelation</a> * pRelation = (pDataMember-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#abcfa16c3cc3ae21faa0a686c18c84f57">hasSqlRelation</a>() ? pDataMember-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#a6300fd163bce788f01ab70284d48230a">getSqlRelation</a>() : NULL); <span class="keywordflow">if</span> (! pRelation) { <span class="keywordflow">return</span> QVariant(); }
<a name="l00389"></a>00389       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItem = this-&gt;<a class="code" href="classqx_1_1_qx_model.html#af224b3a787360a263078e2d3c0ea843a" title="Model associated to a class registered into QxOrm context.">m_model</a>.<a class="code" href="classqx_1_1_qx_collection.html#ab20d863744dee2eac0752757e027e8be" title="Return the item at index position &#39;index&#39;.">getByIndex</a>(row); <span class="keywordflow">if</span> (! pItem) { <span class="keywordflow">return</span> QVariant(); }
<a name="l00390"></a>00390       <a class="code" href="classqx_1_1_qx_model.html#aef823670a8fc66b5d0c8d887034b45a6">type_ptr</a> pItemTemp = pItem;
<a name="l00391"></a>00391 
<a name="l00392"></a>00392       <span class="keywordflow">if</span> (bLoadFromDatabase)
<a name="l00393"></a>00393       {
<a name="l00394"></a>00394          QString sRelation = relation;
<a name="l00395"></a>00395          <span class="keywordflow">if</span> (! sAppendRelations.isEmpty() &amp;&amp; ! sAppendRelations.startsWith(<span class="stringliteral">&quot;-&gt;&quot;</span>) &amp;&amp; ! sAppendRelations.startsWith(<span class="stringliteral">&quot;&gt;&gt;&quot;</span>)) { sRelation += <span class="stringliteral">&quot;-&gt;&quot;</span> + sAppendRelations; }
<a name="l00396"></a>00396          <span class="keywordflow">else</span> <span class="keywordflow">if</span> (! sAppendRelations.isEmpty()) { sRelation += sAppendRelations; }
<a name="l00397"></a>00397          pItemTemp = <a class="code" href="classqx_1_1_qx_model_service.html#a8e6a0368bc703bee2560d26f09394307">type_ptr</a>(<span class="keyword">new</span> T());
<a name="l00398"></a>00398          QVariant <span class="keywordtype">id</span> = this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#aeb41e750a0e5ae206fe671cb94c7eb0f">toVariant</a>(pItem.get());
<a name="l00399"></a>00399          this-&gt;<a class="code" href="classqx_1_1_ix_model.html#ade76aa8736c82f2d43e09d38f0b9f933" title="Primary key (property id) defined into QxOrm context.">m_pDataMemberId</a>-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#ab745b2a043797eecfe769c3f51257a35">fromVariant</a>(pItemTemp.get(), id);
<a name="l00400"></a>00400 
<a name="l00401"></a>00401          S services; QStringList columns;
<a name="l00402"></a>00402          QSqlError daoError = services.fetchById(pItemTemp, columns, QStringList() &lt;&lt; sRelation);
<a name="l00403"></a>00403          <span class="keywordflow">if</span> (daoError.isValid()) { <span class="keywordflow">return</span> QVariant(); }
<a name="l00404"></a>00404       }
<a name="l00405"></a>00405 
<a name="l00406"></a>00406       QJsonValue json = pDataMember-&gt;<a class="code" href="classqx_1_1_ix_data_member.html#a6d0a637cfb402963a06177729a2cdc50">toJson</a>(pItemTemp.get()); <span class="keywordflow">if</span> (json.isNull()) { <span class="keywordflow">return</span> QVariant(); }
<a name="l00407"></a>00407       <span class="keywordflow">if</span> (json.isArray()) { <span class="keywordflow">return</span> json.toArray().toVariantList(); }
<a name="l00408"></a>00408       <span class="keywordflow">return</span> json.toObject().toVariantMap();
<a name="l00409"></a>00409    }
<a name="l00410"></a>00410 
<a name="l00411"></a>00411 <span class="preprocessor">#endif // _QX_NO_JSON</span>
<a name="l00412"></a>00412 <span class="preprocessor"></span>
<a name="l00413"></a>00413 };
<a name="l00414"></a>00414 
<a name="l00415"></a>00415 } <span class="comment">// namespace qx</span>
<a name="l00416"></a>00416 
<a name="l00417"></a>00417 <span class="preprocessor">#endif // _QX_MODEL_SERVICE_H_</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_qx_model_service_8h.html">QxModelService.h</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">Generated on Sun Dec 11 2016 13:41:04 for QxOrm by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
